load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "mockcopr",
    srcs = [
        "aggregate.go",
        "analyze.go",
        "checksum.go",
        "cop_handler_dag.go",
        "copr_handler.go",
        "executor.go",
        "rpc_copr.go",
        "topn.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/store/mockstore/mockcopr",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/expression",
        "//pkg/expression/aggregation",
        "//pkg/kv",
        "//pkg/parser/ast",
        "//pkg/parser/charset",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/sessionctx",
        "//pkg/sessionctx/stmtctx",
        "//pkg/statistics",
        "//pkg/tablecodec",
        "//pkg/types",
        "//pkg/util/chunk",
        "//pkg/util/codec",
        "//pkg/util/collate",
        "//pkg/util/mock",
        "//pkg/util/rowcodec",
        "//pkg/util/timeutil",
        "@com_github_golang_protobuf//proto",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_kvproto//pkg/coprocessor",
        "@com_github_pingcap_kvproto//pkg/errorpb",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_pingcap_tipb//go-tipb",
        "@com_github_tikv_client_go_v2//testutils",
        "@com_github_tikv_client_go_v2//tikvrpc",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_google_grpc//metadata",
    ],
)

go_test(
    name = "mockcopr_test",
    timeout = "short",
    srcs = [
        "executor_test.go",
        "main_test.go",
    ],
    embed = [":mockcopr"],
    flaky = True,
    deps = [
        "//pkg/domain",
        "//pkg/kv",
        "//pkg/parser/model",
        "//pkg/session",
        "//pkg/store/mockstore/mockstorage",
        "//pkg/tablecodec",
        "//pkg/testkit",
        "//pkg/testkit/testmain",
        "//pkg/testkit/testsetup",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//testutils",
        "@com_github_tikv_client_go_v2//tikv",
        "@org_uber_go_goleak//:goleak",
    ],
)
